#列表
list1 = []
list2 = list()
list3 = [1,2,3,4,5]
print(list3)
for i in list3:
    print(i,end='')




print(list3[0])
print(list3[-1])
print(list3[:3])
print(list3[2:])
print(list3[::-1])#倒序[5,4,3,2,1]

list3.append(6)
print(list3)
list3.insert(2,7)
print(list3)
list3.extend([7,8])
print(list3)

# list4.sort
# list4.reverse()
# print(list4)

#排序 不改变原列表

lise4=[11,22,33,44,55,66,77]
lise4=[i for i in lise4]
print(lise4)
list4_new = sorted(list)
print(list)
print(list4_new)


list3[0]=100
list5=[i for i in list3 if i>100]
print(list5)


tuple1=()
tuple2=tuple()
tuple3=(1,2,3,4,5)
print(tuple3)
for i in tuple3:
    print(i,end='')

#元组
    print(tuple3[0])
    print(tuple3[-1])
    print(tuple3[1:4])
    print(tuple3[:3])
    print(tuple3[::2])


# 集合
set1=set([1,2,3,4,5,3,5,7])
print(set1)


dict0={}
dict1=dict()
dict2={'name':'张三','age':18,'sex':'男'}
print(dict2)
print(dict2['name'])
print(dict2['age'])
for key , value in dict2.items():
    print(key,value)

for key,value in dict2.items():
    print(key)


print(dict2. get ('id','没有相关数据'))
print(dict2.get('id2'))#Nome

dict2['id']=100
print(dict2)
dict2['id']=101
print(dict2)
dict2.update({'id':102,'sex':'女'})
print(dict2)


list8=[1,2,3]
list9=[4,5,6]
print(list8+list9)

print('*'*10)
print(list8*3)

tuple4=(1,2,3)
tuple5=tuple4*3
print(tuple4+tuple4)




